<!DOCTYPE html><html lang="zh-Hans"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><meta name="description" content="图片EXIF信息查看与Exiftool使用"><meta name="keywords" content=""><meta name="author" content="kyren"><meta name="copyright" content="kyren"><title>图片EXIF信息查看与Exiftool使用 | Kyren's Blog</title><link rel="shortcut icon" href="/melody-favicon.ico"><link rel="stylesheet" href="/css/index.css?version=1.9.0"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css?version=1.9.0"><meta name="format-detection" content="telephone=no"><meta http-equiv="x-dns-prefetch-control" content="on"><link rel="dns-prefetch" href="https://cdn.jsdelivr.net"><link rel="dns-prefetch" href="https://hm.baidu.com"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?cf87fcdbd9ab7cf93d894f7c219ae78f";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();</script><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><script src="https://v1.hitokoto.cn/?encode=js&amp;charset=utf-8&amp;select=.footer_custom_text" defer></script><script>var GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容:${query}"}},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  hexoVersion: '6.2.0'
} </script><meta name="generator" content="Hexo 6.2.0"></head><body><i class="fa fa-arrow-right" id="toggle-sidebar" aria-hidden="true"></i><div id="sidebar" data-display="true"><div class="toggle-sidebar-info text-center"><span data-toggle="切换文章详情">切换站点概览</span><hr></div><div class="sidebar-toc"><div class="sidebar-toc__title">目录</div><div class="sidebar-toc__progress"><span class="progress-notice">你已经读了</span><span class="progress-num">0</span><span class="progress-percentage">%</span><div class="sidebar-toc__progress-bar"></div></div><div class="sidebar-toc__content"><ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%80%E3%80%81%E4%BB%80%E4%B9%88%E6%98%AFEXIF"><span class="toc-number">1.</span> <span class="toc-text">一、什么是EXIF</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#EXIF%E5%9C%A8%E7%BA%BF%E6%9F%A5%E7%9C%8B"><span class="toc-number">1.0.1.</span> <span class="toc-text">EXIF在线查看</span></a></li></ol></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BA%8C%E3%80%81Exiftool%E4%BD%BF%E7%94%A8"><span class="toc-number">2.</span> <span class="toc-text">二、Exiftool使用</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%B8%80%EF%BC%89%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BD%BF%E7%94%A8Exiftool"><span class="toc-number">2.1.</span> <span class="toc-text">一）为什么使用Exiftool</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E4%BA%8C%EF%BC%89Exiftool%E5%AE%89%E8%A3%85%E4%B8%8E%E4%BD%BF%E7%94%A8"><span class="toc-number">2.1.1.</span> <span class="toc-text">二）Exiftool安装与使用</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#1%E3%80%81exiftool%E5%AE%89%E8%A3%85"><span class="toc-number">2.1.2.</span> <span class="toc-text">1、exiftool安装</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2%E3%80%81%E6%9F%A5%E7%9C%8BEXIF%E4%BF%A1%E6%81%AF"><span class="toc-number">2.1.3.</span> <span class="toc-text">2、查看EXIF信息</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#3%E3%80%81Exiftool%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%E7%A4%BA%E4%BE%8B"><span class="toc-number">2.1.4.</span> <span class="toc-text">3、Exiftool常用命令示例</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#4%E3%80%81%E6%9F%A5%E8%AF%A2%E7%9B%B8%E5%85%B3%E5%91%BD%E4%BB%A4"><span class="toc-number">2.1.5.</span> <span class="toc-text">4、查询相关命令</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#5%E3%80%81%E5%86%99%E5%85%A5%E7%BC%96%E8%BE%91%E5%91%BD%E4%BB%A4"><span class="toc-number">2.1.6.</span> <span class="toc-text">5、写入编辑命令</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#6%E3%80%81%E4%BD%BF%E7%94%A8ExifTool%E6%89%B9%E9%87%8F%E5%A4%84%E7%90%86EXIF%E4%BF%A1%E6%81%AF"><span class="toc-number">2.1.7.</span> <span class="toc-text">6、使用ExifTool批量处理EXIF信息</span></a></li></ol></li></ol></li></ol></div></div><div class="author-info hide"><div class="author-info__avatar text-center"><img src="https://avatars.githubusercontent.com/u/5827823?v=4"></div><div class="author-info__name text-center">kyren</div><div class="author-info__description text-center">huluo的技术博客</div><div class="follow-button"><a target="_blank" rel="noopener" href="https://github.com/huluo666">Follow Me</a></div><hr><div class="author-info-articles"><a class="author-info-articles__archives article-meta" href="/archives"><span class="pull-left">文章</span><span class="pull-right">239</span></a><a class="author-info-articles__tags article-meta" href="/tags"><span class="pull-left">标签</span><span class="pull-right">41</span></a><a class="author-info-articles__categories article-meta" href="/categories"><span class="pull-left">分类</span><span class="pull-right">29</span></a></div><hr><div class="author-info-links"><div class="author-info-links__title text-center">Links</div><a class="author-info-links__name text-center" target="_blank" rel="noopener" href="http://192.168.2.212:9090/">Jira</a><a class="author-info-links__name text-center" target="_blank" rel="noopener" href="http://192.168.2.212:8090/">Confluence</a><a class="author-info-links__name text-center" target="_blank" rel="noopener" href="http://bloc.leniugame.com/">Leniu</a></div></div></div><div id="content-outer"><div class="no-bg" id="top-container"><div id="page-header"><span class="pull-left"> <a id="site-name" href="/">Kyren's Blog</a></span><i class="fa fa-bars toggle-menu pull-right" aria-hidden="true"></i><span class="pull-right menus">   <a class="site-page" href="/">主页</a><a class="site-page" href="/essay">随笔</a><a class="site-page" href="/archives">归档</a><a class="site-page" href="/tags">标签</a><a class="site-page" href="/categories">分类</a><a class="site-page" href="/about">关于</a></span><span class="pull-right"><a class="site-page social-icon search"><i class="fa fa-search"></i><span> 搜索</span></a></span></div><div id="post-info"><div id="post-title">图片EXIF信息查看与Exiftool使用</div><div id="post-meta"><time class="post-meta__date"><i class="fa fa-calendar" aria-hidden="true"></i> 2018-03-02</time></div></div></div><div class="layout" id="content-inner"><article id="post"><div class="article-container" id="post-content"><p>​	今天元宵节，一位版主在论坛发了一篇元宵节祝福帖，一大早就有用户报障说帖子中有张图片看不了，安卓端正常，第一反应是图片格式问题，用Safari打开也看不了，回到公司证实了是一张webp格式图片，最后将其转换成jpg格式发给了用户重新上传替换。</p>
<p>下图后缀是jpg，实际是webp，在谷歌系浏览器上才显示正常</p>
<p><img src="http://7xr7vj.com1.z0.glb.clouddn.com/76572794.jpg" alt="76572794"></p>
<h3 id="一、什么是EXIF"><a href="#一、什么是EXIF" class="headerlink" title="一、什么是EXIF"></a>一、什么是EXIF</h3><p>​     可交换图像文件格式常被简称为Exif（Exchangeable image file format），是专门为数码相机的照片设定的，可以记录数码照片的属性信息和拍摄数据。Exif 可以被附加在 JPEG、TIFF、RIFF 等文件之中，为其增加有关数码相机拍摄信息的内容和缩略图或图像处理软件的一些版本信息。</p>
<p>了解更多：<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/EXIF">维基百科</a></p>
<h5 id="EXIF在线查看"><a href="#EXIF在线查看" class="headerlink" title="EXIF在线查看"></a>EXIF在线查看</h5><p><a target="_blank" rel="noopener" href="https://exif.tuchong.com/">图虫EXIF查看器alpha版</a></p>
<p><a target="_blank" rel="noopener" href="http://ganquan.info/exif-viewer/">exif-viewer</a></p>
<p><a target="_blank" rel="noopener" href="https://www.get-metadata.com/">get-metadata</a> (支持图片、其它文件)</p>
<p><a target="_blank" rel="noopener" href="http://exif.regex.info/exif.cgi">http://exif.regex.info/exif.cgi</a> 支持URL链接</p>
<p>以上几个是使用过的对图片EXIF解析支持最好的，网上的一些工具会解析失败。</p>
<h3 id="二、Exiftool使用"><a href="#二、Exiftool使用" class="headerlink" title="二、Exiftool使用"></a>二、Exiftool使用</h3><h4 id="一）为什么使用Exiftool"><a href="#一）为什么使用Exiftool" class="headerlink" title="一）为什么使用Exiftool"></a>一）为什么使用Exiftool</h4><ul>
<li><code>exiftool</code>是经过测试发现对图片EXIF信息解析支持是最好的（如果有更好的请补充）</li>
<li><code>exiftool</code>支持图片EXIF信息查询，修改及批量操作，还支持其它文件的EXIF操作。</li>
<li>安全隐私问题，因为经常有网上暴露图片隐私问题，使用在线需要上传到服务器。采用<code>exiftool</code>保证了图片的安全和隐私，显然是最适合的。</li>
</ul>
<p>​	我们知道文件后缀名并不能代表文件的类型格式，比如上图webp格式后缀名是jpg，换言之一张jpg后缀名图片可能不是jpg图片，可能是<code>web</code>，<code>png</code>，<code>text</code>或其它类型文件。那么怎么快速了解它是哪种类型文件并获取它的一些其它信息呢，这时<code>exiftool</code>就派上用场了，试了下其它几个Exif工具，也用Mac&#x2F;iOS原生代码测试了下，发现不能有效的读取jpg后缀的webp图片，而exiftool能很好支持。注意并非每一张图片都包含 exif 信息。像微信朋友圈如果发表的不是原图就没有。</p>
<h5 id="二）Exiftool安装与使用"><a href="#二）Exiftool安装与使用" class="headerlink" title="二）Exiftool安装与使用"></a>二）Exiftool安装与使用</h5><h5 id="1、exiftool安装"><a href="#1、exiftool安装" class="headerlink" title="1、exiftool安装"></a>1、exiftool安装</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">brew install exiftool</span></span><br></pre></td></tr></table></figure>

<p>或直接下载：<a target="_blank" rel="noopener" href="https://sno.phy.queensu.ca/~phil/exiftool/">https://sno.phy.queensu.ca/~phil/exiftool/</a></p>
<h5 id="2、查看EXIF信息"><a href="#2、查看EXIF信息" class="headerlink" title="2、查看EXIF信息"></a>2、查看EXIF信息</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">exiftool photo.jpg  <span class="comment">#默认显示所有的信息 exiftool+图片路径/图片名.jpg</span></span></span><br></pre></td></tr></table></figure>

<p>输出信息如下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">$ ExifTool /Users/apple/Desktop/photo.jpg</span></span><br><span class="line">ExifTool Version Number         : 10.80</span><br><span class="line">File Name                       : photo.jpg</span><br><span class="line">Directory                       : /Users/pconline/Desktop</span><br><span class="line">File Size                       : 18 kB</span><br><span class="line">File Modification Date/Time     : 2018:03:02 10:22:03+08:00</span><br><span class="line">File Access Date/Time           : 2018:03:02 11:47:58+08:00</span><br><span class="line">File Inode Change Date/Time     : 2018:03:02 11:47:57+08:00</span><br><span class="line">File Permissions                : rw-r--r--</span><br><span class="line">File Type                       : WEBP</span><br><span class="line">File Type Extension             : webp</span><br><span class="line">MIME Type                       : image/webp</span><br><span class="line">VP8 Version                     : 0 (bicubic reconstruction, normal loop)</span><br><span class="line">Image Width                     : 640</span><br><span class="line">Horizontal Scale                : 0</span><br><span class="line">Image Height                    : 400</span><br><span class="line">Vertical Scale                  : 0</span><br><span class="line">Image Size                      : 640x400</span><br><span class="line">Megapixels                      : 0.256</span><br></pre></td></tr></table></figure>

<h5 id="3、Exiftool常用命令示例"><a href="#3、Exiftool常用命令示例" class="headerlink" title="3、Exiftool常用命令示例"></a>3、Exiftool常用命令示例</h5><p>终端输入</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">exiftool -h <span class="comment">#查看使用详细列表</span></span></span><br></pre></td></tr></table></figure>

<p>使用帮助，可看到所有命令帮助，也可看到exiftool的支持文件类型和文件元信息如下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">File Types</span><br><span class="line">----------------------+----------------------+---------------------</span><br><span class="line">3G2   r/w   | DVB   r/w   | JPEG  r/w   | ODT   r     | RIFF  r</span><br><span class="line">....</span><br><span class="line">Meta Information</span><br><span class="line">----------------------+----------------------+---------------------</span><br><span class="line">EXIF           r/w/c  |  CIFF           r/w  |  Ricoh RMETA    r</span><br><span class="line">GPS            r/w/c  |  AFCP           r/w  |  Picture Info   r</span><br><span class="line">IPTC           r/w/c  |  Kodak Meta     r/w  |  Adobe APP14    r</span><br><span class="line">XMP            r/w/c  |  FotoStation    r/w  |  MPF            r</span><br><span class="line">MakerNotes     r/w/c  |  PhotoMechanic  r/w  |  Stim           r</span><br><span class="line">Photoshop IRB  r/w/c  |  JPEG 2000      r    |  DPX            r</span><br><span class="line">ICC Profile    r/w/c  |  DICOM          r    |  APE            r</span><br><span class="line">MIE            r/w/c  |  Flash          r    |  Vorbis         r</span><br><span class="line">JFIF           r/w/c  |  FlashPix       r    |  SPIFF          r</span><br><span class="line">Ducky APP12    r/w/c  |  QuickTime      r    |  DjVu           r</span><br><span class="line">PDF            r/w/c  |  Matroska       r    |  M2TS           r</span><br><span class="line">PNG            r/w/c  |  MXF            r    |  PE/COFF        r</span><br><span class="line">Canon VRD      r/w/c  |  PrintIM        r    |  AVCHD          r</span><br><span class="line">Nikon Capture  r/w/c  |  FLAC           r    |  ZIP            r</span><br><span class="line">GeoTIFF        r/w/c  |  ID3            r    |  (and more)</span><br></pre></td></tr></table></figure>

<h5 id="4、查询相关命令"><a href="#4、查询相关命令" class="headerlink" title="4、查询相关命令"></a>4、查询相关命令</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$</span><span class="language-bash"><span class="built_in">cd</span> /Users/apple/Desktop</span></span><br><span class="line">exiftool photo.jpg #查看所有信息</span><br><span class="line">exiftool -a -u -g1 photo.jpg #查看所有元信息，包括重复和未知标签，并按小组排列</span><br><span class="line">exiftool -s -ImageSize -ExposureTime photo.jpg #查看图片尺寸</span><br><span class="line">exiftool -common dir  #查看dir目录文件信息（不仅仅是图片）</span><br><span class="line">exiftool -l  c.jpg d.jpg  #从两个图像文件打印所有信息。</span><br><span class="line">exiftool -l -canon c.jpg d.jpg	#从两个图像文件打印标准的佳能信息。</span><br></pre></td></tr></table></figure>

<h5 id="5、写入编辑命令"><a href="#5、写入编辑命令" class="headerlink" title="5、写入编辑命令"></a>5、写入编辑命令</h5><p>更改创建和修改时间</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">exiftool -gps:all= photo.jpg  <span class="comment">#有些相机会记录拍照时的GPS定位信息。如果你不希望别人看到使用该命令删除gps信息</span></span></span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">exiftool -all= photo.jpg  <span class="comment">#删除所有信息</span></span></span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">exiftool -all= --exif:all photo.jpg  <span class="comment">#删除EXIF以外的所有信息</span></span></span><br></pre></td></tr></table></figure>

<p>写入标签</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">exiftool -artist=标签名称 photo.jpg    		 <span class="comment">#写入艺术家标签</span></span></span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">exiftool -artist=标签名称 a.jpg b.jpg c.jpg   <span class="comment">#写多个文件</span></span></span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">exiftool -artist=标签名称  /exiftoolTest      <span class="comment">#写在一个目录的所有文件 exiftoolTest为文件夹</span></span></span><br></pre></td></tr></table></figure>

<p>其它：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br></pre></td><td class="code"><pre><span class="line">exiftool -Comment =&#x27;这是一个新的评论&#x27;dst.jpg</span><br><span class="line">    向JPG图片写入新评论（取代任何现有评论）。</span><br><span class="line"></span><br><span class="line">exiftool -comment = -o newdir -ext jpg。</span><br><span class="line">    删除当前目录中所有JPG图像的评论，</span><br><span class="line">    将修改后的图像写入新目录。</span><br><span class="line"></span><br><span class="line">exiftool -keywords = EXIF -keywords =编辑器dst.jpg</span><br><span class="line">    用两个新的关键字（“EXIF”和。）替换现有的关键字列表</span><br><span class="line">    “编辑”）。</span><br><span class="line"></span><br><span class="line">exiftool -Keywords + =单词-o newfile.jpg src.jpg</span><br><span class="line">    将源图像复制到新文件，然后添加关键字（“单词”）</span><br><span class="line">    当前关键字列表。</span><br><span class="line">            </span><br><span class="line"></span><br><span class="line">exiftool -credit- = xxx dir</span><br><span class="line">    从一个目录中的所有文件中删除信用信息，信用值是“xxx”。</span><br><span class="line"></span><br><span class="line">exiftool -all = dst.jpg</span><br><span class="line">    从图像中删除所有元信息。注意：你不应该</span><br><span class="line">    对RAW图像（DNG除外）进行处理，因为它是专有的RAW图像</span><br><span class="line">    格式通常包含制造注释中的信息</span><br><span class="line">    转换图像所必需的。</span><br><span class="line"></span><br><span class="line">exiftool -all = -comment =&#x27;寂寞&#x27;dst.jpg</span><br><span class="line">    删除图像中的所有元信息并添加评论</span><br><span class="line">    （注意顺序很重要：“-comment =&#x27;lonely&#x27;-all =”</span><br><span class="line">    也会删除新评论。）</span><br><span class="line"></span><br><span class="line">exiftool -all = --jfif：全部dst.jpg</span><br><span class="line">    从图像中删除除JFIF组以外的所有元信息。</span><br><span class="line"></span><br><span class="line">exiftool -Photoshop：全部= dst.jpg</span><br><span class="line">    从图像中删除Photoshop元信息（注意</span><br><span class="line">    Photoshop信息还包括IPTC）。</span><br><span class="line"></span><br><span class="line">exiftool -r -XMP-crss：all = DIR</span><br><span class="line">    递归删除a中的图像中的所有XMP-crss信息</span><br><span class="line">    目录。</span><br><span class="line"></span><br><span class="line">exiftool&#x27;-ThumbnailImage &lt;= thumb.jpg&#x27;dst.jpg</span><br><span class="line">    从指定的文件中设置缩略图（注意：引号是</span><br><span class="line">    以防止外壳重定向）。</span><br><span class="line"></span><br><span class="line">exiftool&#x27;-JpgFromRaw &lt;=％d％f_JFR.JPG&#x27;-ext NEF -r。</span><br><span class="line">    递归地写入以“_JFR.JPG”结尾的文件名的JPEG图像</span><br><span class="line">    添加到扩展名为“.NEF”的类似文件的JpgFromRaw标记中</span><br><span class="line">    当前目录。 （这是“-JpgFromRaw”的倒数</span><br><span class="line">    上面的“READING EXAMPLES”部分的命令）。</span><br><span class="line"></span><br><span class="line">exiftool -DateTimeOriginal - =&#x27;0：0：0 1：30：0&#x27;dir</span><br><span class="line">    调整目录“dir”中所有图像的原始日期/时间</span><br><span class="line">    减去1小时30分钟。 （这相当于</span><br><span class="line">    “-DateTimeOriginal- = 1.5”。请参阅Image :: ExifTool :: Shift.pl</span><br><span class="line">    细节。）</span><br><span class="line"></span><br><span class="line">exiftool -createdate + = 3 -modifydate + = 3 a.jpg b.jpg</span><br><span class="line">    向两个CreateDate和ModifyDate时间戳添加3个小时</span><br><span class="line">    图片。</span><br><span class="line"></span><br><span class="line">exiftool -AllDates + = 1：30 -if&#x27;$ make eq“Canon”&#x27;dir</span><br><span class="line">    移动DateTimeOriginal，CreateDate和ModifyDate的值</span><br><span class="line">    将所有佳能影像转换1小时30分钟</span><br><span class="line">    目录。 （AllDates标签作为这些的快捷方式提供</span><br><span class="line">    三个标签，允许他们通过一个标签访问。）</span><br><span class="line"></span><br><span class="line">exiftool -xmp：city = Kingston image1.jpg image2.nef</span><br><span class="line">    将标签写入两个图像的XMP组。 （没有“xmp：”</span><br><span class="line">    自从“City”存在以后，该标签将被写入IPTC组</span><br><span class="line">    在这两种情况下，IPTC默认是首选。）</span><br><span class="line"></span><br><span class="line">exiftool -LightSource - =&#x27;未知（0）&#x27;dst.tiff</span><br><span class="line">    只有在值为0时才删除“LightSource”标签。</span><br><span class="line"></span><br><span class="line">exiftool -whitebalance- = auto -WhiteBalance = tung dst.jpg</span><br><span class="line">    只有之前为“自动”时，才将“WhiteBalance”设置为“Tungsten”。</span><br><span class="line"></span><br><span class="line">exiftool -comment- = -comment =&#x27;新评论&#x27;a.jpg</span><br><span class="line">    只有当图片还没有时才写新评论。</span><br><span class="line"></span><br><span class="line">exiftool -o％d％f.xmp目录</span><br><span class="line">    为“dir”中的所有图像创建XMP元信息数据文件。</span><br><span class="line"></span><br><span class="line">exiftool -o test.xmp -owner = Phil -title =&#x27;XMP File&#x27;</span><br><span class="line">    仅从命令中定义的标签创建XMP数据文件</span><br><span class="line">    线。</span><br></pre></td></tr></table></figure>

<p>更多命令查看<code>exiftool -h</code></p>
<p><a target="_blank" rel="noopener" href="http://owl.phy.queensu.ca/~phil/exiftool/examples.html">http://owl.phy.queensu.ca/~phil/exiftool/examples.html</a></p>
<h5 id="6、使用ExifTool批量处理EXIF信息"><a href="#6、使用ExifTool批量处理EXIF信息" class="headerlink" title="6、使用ExifTool批量处理EXIF信息"></a>6、使用ExifTool批量处理EXIF信息</h5><p>如果要处理的文件太多，一张一张处理效率太低，ExifTool支持批量操作：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">exiftool -artist=标签名称  /dirName    <span class="comment">#批量写入dirName目录艺术家标签</span></span></span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">exiftool -r -all= /dirName  	  <span class="comment">#批量删除dirName及其子目录所有文件EXIF信息，-r表示递归处理子目录</span></span></span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">exiftool -gps:all= /dirName 	  <span class="comment">#批量删除dirName及其子目录所有文件gps信息</span></span></span><br></pre></td></tr></table></figure>



<p>其它相关：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">mdls  photo.jpg <span class="comment">#这个命令显示指定文件的metadata的属性,当不能准确的获取exif信息</span></span></span><br></pre></td></tr></table></figure>

<p>iOS端获取metadata</p>
<p><a target="_blank" rel="noopener" href="https://stackoverflow.com/questions/9766394/get-exif-data-from-uiimage-uiimagepickercontroller">https://stackoverflow.com/questions/9766394/get-exif-data-from-uiimage-uiimagepickercontroller</a></p>
<p><a target="_blank" rel="noopener" href="https://stackoverflow.com/questions/16830180/how-to-get-exif-data-from-downloaded-image">https://stackoverflow.com/questions/16830180/how-to-get-exif-data-from-downloaded-image</a></p>
<p>测试发现，如果是网络webp图片,如果后缀是jpg或png不能准确获取Exif信息，系统相册没问题。</p>
<p>参考：</p>
<p><a target="_blank" rel="noopener" href="http://owl.phy.queensu.ca/~phil/exiftool/examples.html">http://owl.phy.queensu.ca/~phil/exiftool/examples.html</a></p>
<p><a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/EXIF">https://zh.wikipedia.org/wiki/EXIF</a></p>
<p><a target="_blank" rel="noopener" href="https://baike.baidu.com/item/EXIF/422825">https://baike.baidu.com/item/EXIF/422825</a></p>
</div></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">kyren</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://huluo666.gitee.io/2018/03/02/图片EXIF信息查看/">http://huluo666.gitee.io/2018/03/02/图片EXIF信息查看/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://huluo666.gitee.io">Kyren's Blog</a>！</span></div></div><div class="post-meta__tag-list"></div><nav id="pagination"><div class="prev-post pull-left"><a href="/2018/03/02/AFNetWorking3.x%E4%BD%BF%E7%94%A8/"><i class="fa fa-chevron-left">  </i><span>AFNetworking3x使用</span></a></div><div class="next-post pull-right"><a href="/2018/02/28/iOS%E7%82%B9%E5%AF%B9%E7%82%B9%E7%9B%B4%E6%92%ADWebRTC%E7%A0%94%E7%A9%B6/"><span>iOS点对点直播WebRTC研究</span><i class="fa fa-chevron-right"></i></a></div></nav></div></div><footer><div class="layout" id="footer"><div class="copyright">&copy;2022 By kyren</div><div class="framework-info"><span>驱动 - </span><a target="_blank" rel="noopener" href="http://hexo.io"><span>Hexo</span></a><span class="footer-separator">|</span><span>主题 - </span><a target="_blank" rel="noopener" href="https://github.com/Molunerfinn/hexo-theme-melody"><span>Melody</span></a></div><div class="footer_custom_text">hitokoto</div><div class="busuanzi"><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><span id="busuanzi_container_page_pv"><i class="fa fa-file"></i><span id="busuanzi_value_page_pv"></span><span></span></span></div></div></footer><i class="fa fa-arrow-up" id="go-up" aria-hidden="true"></i><script src="https://cdn.jsdelivr.net/npm/animejs@latest/lib/anime.min.js"></script><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-animate@latest/velocity.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-ui-pack@latest/velocity.ui.min.js"></script><script src="/js/utils.js?version=1.9.0"></script><script src="/js/fancybox.js?version=1.9.0"></script><script src="/js/sidebar.js?version=1.9.0"></script><script src="/js/copy.js?version=1.9.0"></script><script src="/js/fireworks.js?version=1.9.0"></script><script src="/js/transition.js?version=1.9.0"></script><script src="/js/scroll.js?version=1.9.0"></script><script src="/js/head.js?version=1.9.0"></script><script src="/js/search/local-search.js"></script><script>if(/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) {
  $('#nav').addClass('is-mobile')
  $('footer').addClass('is-mobile')
  $('#top-container').addClass('is-mobile')
}</script><div class="search-dialog" id="local-search"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章"></div></div></div><hr><div id="local-search-results"><div id="local-hits"></div><div id="local-stats"><div class="local-search-stats__hr" id="hr"><span>由</span> <a target="_blank" rel="noopener" href="https://github.com/wzpan/hexo-generator-search" style="color:#49B1F5;">hexo-generator-search</a>
 <span>提供支持</span></div></div></div><span class="search-close-button"><i class="fa fa-times"></i></span></div><div class="search-mask"></div></body></html>